<script>
    /****************************Check*Form*Valid********************************/
    $(function(){
        $("#formcheck").validate({
            rules: {
                cat: "required"
            },
            messages: {
                cat: "Ce champ est obligatoire !"
            }
        });
    });
</script>
<table class="titrepage" width="1000px">
    <tr>              
        <td><a class="titrea" href="<?php echo site_url('avis_admin/list_news');?>">La liste des News</a></td>
        <td width="300px">La liste des categories</td>
        <td align="right">Total | <?php echo $this->db->count_all('categories');?></td>

    </tr>
</table>


<table class="list"   width="100%">
    <thead>
        <tr>
            <th width="300px">Categorie</th>
            <th width="100px">Modification</th>
            <th width="100px">Suppression</th>    
        </tr>
    </thead>
    <?php foreach($query as $row):?>
        <tr>
            <td><?php echo $row['name'];?></td>
            <td><a href="<?php echo site_url('avis_admin/update_cat/'.$row['id']);?>">Modification</a></td>
            <td><a href="<?php echo site_url('avis_admin/delete_cat/'.$row['id'].'/'.$per_page.'/'.$off_set);?>" onclick="return confirm('Are you sure?');">Suppression</a></td>
        </tr>
        <?php endforeach;?>
        <tr>
            <td colspan="3"><?php echo $pagination?></td>
        </tr> 
    <tbody>
    </tbody>
</table>

<div class="bajouter" align="center">Ajouter un categorie</div>
<div style="margin:10px 0px 10px 0px;display:none;">
    <form method="POST" id="formcheck" action="<?php echo site_url('avis_admin/add_category')?>" enctype="multipart/form-data">
        <table width="100%" id="formactu" cellpadding="10px" cellspacing="0">
            <tr>
                <td><span>Categorie</span><input  type="text" name="cat" ><br/></td>
                <td><input type="submit" name="submit" value="SUBMIT" alt="Submit"></td>
            </tr>
        </table>
    </form>
</div>